<?php
$adminDelete = "";
$obj = "\$object_$class";

$adminDelete .="<?php".$CR."include(\"../../config/config.php\");".$CR;

$adminDelete .="\$DM->loadClass(\"$package\",\"$class\");".$CR;
$adminDelete .="// create and instance class".$CR;
$adminDelete .=$obj." = new $class();".$CR;

for ($i=0;$i<count($var);$i++){
	if ($var[$i]["PK"]=="PRIMARYKEY" || $var[$i]["PK"]	=="PK"){	
		$adminDelete .=$obj."->".$var[$i]["name"]." = array_key_exists(\"".$var[$i]["name"]."\",\$_GET)?\$_GET[\"".$var[$i]["name"]."\"]:\"\"; ".$CR;
	}
}	

$adminDelete .="if (".$obj."->delete()){".$CR;
$adminDelete .="	header(\"Location: $class.list.php\");".$CR;
$adminDelete .="}else{".$CR;
$adminDelete .="	exit(\"Erro ao APAGAR $class\");".$CR;
$adminDelete .="}".$CR;

$adminDelete .="?>".$CR;

?>

